/**
 * 
 */
package com.estock.platform.http.response;

import java.util.HashMap;
import java.util.Map;

/**
 * @author richard
 *
 */
public abstract class JSONResponse {
	
	protected String body;
    protected String contentType;
    protected int responseCode;

	protected Map<String, Object> parameters = new HashMap<String, Object>();

    public String getParam(String param) {
        Object value = parameters.get(param);
        return value == null ? null : String.valueOf(value);
    }
    
    protected abstract void setBody(String body) throws Exception;

    protected abstract void setContentType(String contentTypr);

    protected abstract void setResponseCode(int responseCode);
    
    public void init(String body, String contentType, int responseCode) throws Exception {
    	this.setBody(body);
        this.setContentType(contentType);
        this.setResponseCode(responseCode);
    }
    
}
